-module(handler).

-export([handle/1]).

-include("megaeyes.hrl").


handle(Message)->
    case Message#message.id rem 2 of 
	0 ->
	    handle_request(Message);
	1 ->
	    handle_response(Message)
    end.

%local function
handle_request(Request) ->
    {Mod,Fun} = get_handler(Request#message.id),
    Mod:Fun(Request).
    
get_handler(Id) ->
    case Id of
	5002 ->
	    {handlerbase,handle_login};
	_Other ->
	    {handlerbase,handle_other}
    end.

handle_response(_Resp) ->
    {ok,noerror}.
